package team093;

import battlecode.common.GameConstants;
import battlecode.common.MapLocation;
import battlecode.common.TerrainTile;
import battlecode.common.TerrainTile.TerrainType;

public class Knowledge {
	private int[][] mapElevation;
	private TerrainType[][] mapTerrainType;
	
	private int mapWidth;
	private int mapHeight;
	
	private static Knowledge instance;
	
	static {
		instance = new Knowledge(GameConstants.MAP_MAX_HEIGHT, GameConstants.MAP_MAX_WIDTH);
	}
	
	private Knowledge(int height, int width) {
		mapWidth = width;
		mapHeight = height;
		
		mapElevation = new int[height][width];
		mapTerrainType = new TerrainType[height][width];
	}
	
	public Knowledge getInstance() {
		return instance;
	}
	
	public int getMapElevationAt(int x, int y) {
		return mapElevation[y][x];
	}
	
	public TerrainType getMapTerrainTypeAt(int x, int y) {
		return mapTerrainType[y][x];
	}
	
	public void addKnowledge(MapLocation location, TerrainTile tile) {
		int x = location.getX();
		int y = location.getY();
		mapElevation[y][x] = tile.getHeight();
		mapTerrainType[y][x] = tile.getType();
	}
}
